package chapter04.Demo.Demo04;

import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

/**
 * 接口
 * 电脑=机箱+电源+主板+CPU+显卡+内存+硬盘+散热
 */

interface jixiang{//机箱
    String RongLiang = "mini";
    void setRongLiang(String RongLiang);
}
interface DianYuan{//电源
    String Gonglv = "500W";
    void setGonglv(String Gonglv);
}
interface CPU{
    String Hz="2.4G";//频率
    int CoreNum=1;//核心数量
    void setHz(String hz);
    void setCoreNum(int CoreNum);
}
interface zhuban{//主板
    String Pinpai="华硕";
    void setPinpai(String pinpai);
}
//接口继承接口 无需实现方法
interface Diannao extends jixiang,DianYuan,CPU,zhuban{}
//类继承接口 需要实现所有的接口方法 类用implements继承多个接口
class PersonComputer implements jixiang,DianYuan,CPU,zhuban{
    public void setPinpai(String pinpai){
        System.out.println("品牌被final了改不了了");
    }
    public void setCoreNum(int CoreNum){
        System.out.println("核心数量被final了改不了了");
    }
    public void setGonglv(String gonglv){
        System.out.println("功率被final了改不了了");
    }
    public void setRongLiang(String Rongliang){
        System.out.println("容量被final了改不了了");
    }
    public void setHz(String hz){
        System.out.println("赫兹被final了改不了了");
    }
}
public class Demo04 {
    public static void main(String[] args) {
        PersonComputer pc = new PersonComputer();
        pc.setCoreNum(2);
        System.out.println(pc.Hz);
        System.out.println("接口定义一时爽,接口实现火葬场");
    }
}
